﻿using Test20230505;
using Microsoft.Extensions.Logging;
using Microsoft.EntityFrameworkCore;

namespace Test20230505;

public static class MauiProgram
{
	public static MauiApp CreateMauiApp()
	{
		var builder = MauiApp.CreateBuilder();
		builder
			.UseMauiApp<App>()
			.ConfigureFonts(fonts =>
			{
				fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
			});
        //注入SQlite服务
        string dbPath = Path.Combine(FileSystem.AppDataDirectory, "testgogogo.db");
        builder.Services.AddDbContext<MyDbContext>(options => options.UseSqlite($"Filename={dbPath}"));
        builder.Services.AddMauiBlazorWebView();
        // 增加 BootstrapBlazor 服务
        builder.Services.AddBootstrapBlazor(null, options =>
        {
            // 忽略本地化键值文化信息丢失
            options.IgnoreLocalizerMissing = true;
        });

#if DEBUG
        builder.Services.AddBlazorWebViewDeveloperTools();
		builder.Logging.AddDebug();
#endif


		return builder.Build();
	}
}

